{include file="public/layout" /}
<body class="bodystyle" style="cursor: default; -moz-user-select: inherit;min-width:auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="shop_product/left" /}
<div class="page min-hg-c-10" style="min-width: auto; margin-left: 100px;">
    <div class="flexigrid">
        <div class="mDiv pt0">
            <div class="ftitle">
                <div class="fbutton">
                    <a href="JavaScript:void(0);" onclick="insertGoodsLabel();">
                        <div class="add"><span><i class="layui-icon layui-icon-addition"></i>添加商品服务</span></div>
                    </a>
                </div>
            </div>
        </div>

        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0" style="width: 100%">
                    <thead>
                        <tr>
                            <th class="w40"> <div class="tc">ID</div> </th>
                            <th class="w200"> <div class="tl" style="padding-left: 20px;">商品服务</div> </th>
                            <th > <div class="text-l10">描述</div> </th>
                            <!-- <th class="w80"> <div class="tc">默认勾选</div> </th> -->
                            <th class="w80"> <div class="tc">操作</div> </th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto; min-height: auto;">
            <form id="PostForm">
                <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                    <table style="width: 100%">
                        <tbody id="goodsLabelList">
                            {include file="shop_product/goods_label_list" /}
                        </tbody>
                    </table>
                </div>
            </form>
            <div class="iDiv" style="display: none;"></div>
        </div>
    </div>
</div>

<script type="text/javascript">
    // 新增商品服务
    function insertGoodsLabel() {
        $.ajax({
            type: 'post',
            url : "{:url('ShopProduct/goods_label_add')}",
            data: {_ajax: 1},
            dataType: 'json',
            success: function(res) {
                if (1 === parseInt(res.code)) {
                    $('#goodsLabelList').empty().html(res.data.html);
                } else {
                    showErrorAlert(res.msg);
                }
            }
        });
    }

    // 删除商品服务
    function deleteGoodsLabel(label_id) {
        showConfirm('确认删除该商品服务？', {}, function() {
            layer_loading('正在处理');
            $.ajax({
                type: 'post',
                url : "{:url('ShopProduct/goods_label_del')}",
                data: {label_id: label_id, _ajax: 1},
                dataType: 'json',
                success: function(res) {
                    layer.closeAll();
                    if (1 === parseInt(res.code)) {
                        $('#goodsLabelList').empty().html(res.data.html);
                    } else {
                        showErrorAlert(res.msg);
                    }
                }
            });
        });
    }
</script>

{include file="public/footer" /}